import http from "@/utils/http";

//登录
export const userLogin = (account) => {
  return http.post("login", account);
};

//新增角色
export const rolePost = (roleObj) => {
  return http.post("classes/ReactRole", roleObj);
};

//角色列表
export const roleGet = (roleId) => {
  let params = roleId ? `/${roleId}` : "";
  return http.get(`classes/ReactRole${params}`);
};

//更新角色
export const rolePut = (roleId, roleObj) => {
  return http.put(`classes/ReactRole/${roleId}`, roleObj);
};

//批量删除角色
export const roleDelBatch = (ids) => {
  let requests = ids.map((id) => {
    return {
      method: "DELETE",
      path: `/1.1/classes/ReactRole/${id}`,
    };
  });
  return http.post(`batch`, { requests });
};

// 分配账号
export const userReg = (userObj) => {
  return http.post("users", userObj);
};

//账号列表
export const userGet = () => {
  return http.get("users");
};
